-
Notifications
You must be signed in to change notification settings - Fork 12
feat: clean up unused services and resources #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
shreddedbacon
wants to merge
12
commits into
main
Choose a base branch
from
cleanup-old-services
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1b83d72 to
de56df8
Compare
de56df8 to
cf2a8b9
Compare
|
Edit: now closer to release worthy |
119f2bb to
116a828
Compare
f27f87c to
d07f6e6
Compare
58f17fd to
23f0e4a
Compare
23f0e4a to
f3b10dc
Compare
f3b10dc to
f71f9cd
Compare
3 tasks
8a04da3 to
4c93e12
Compare
e68fa7f to
a1a1b8b
Compare
7c844e7 to
0010cb5
Compare
…ing services works for cleaning up/saving state for future use
046253e to
6205bc8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for cleaning up unused services within an environment.
As Lagoon has typically not cleaned up in the past, this is a potentially dangerous operation in some cases. A user may be unaware that they may still be using or have an old service in their environment, and their application may still be using it.
There isn't any way to actually confirm if a service is still in used by an application during a build, so the action will be to
warnand let the user decide on what action to take.Maybe in the future removals will happen automatically and it will produce a warning still, but no choice in action.
Currently, this can detect and clean up any services, or dangling resources that a service created. In this case a typical service comprises of Kubernetes resources of the types
Deployment, and then depending on the service, aServiceand/or aPersistentVolumeClaim. A service can also be one of the DBaaS types.Once the build has detected these, it will output the resources that would be removed and instruct what to do to have them removed. The user can verify the changes and make the decision to remove them in a future build, but also makes it clear that they need to verify that the resources are not used anymore before they are removed.
A new function that will save the service states into a
lagoon-servicesconfigmap which can be used by the remote-controller to send environment state back to the API for visibility.To properly support all the changes in this in the API and other systems, the following are required, and the references to pr-99 are added in code to identify where the changes will need to be made in the future to use machinery.